home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / StringListBoxEditor.cpp < prev    next >
Text File  |  1997-05-11  |  4KB  |  131 lines

  1. /*
  2.  *  File:       StringListBoxEditor.cpp
  3.  *  Summary:       A view that knows how to edit a TStringListBox.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1997 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <->     1/22/97    JDJ        Created
  12.  */
  13.  
  14. #include "StringListBoxEditor.h"
  15.  
  16. #include <ZControl.h>
  17. #include <ZTextBox.h>
  18.  
  19. #include "RsrcPopupMenu.h"
  20.  
  21.  
  22. // ===================================================================================
  23. //    class CEditStringListBoxCommand
  24. // ===================================================================================
  25.  
  26. //---------------------------------------------------------------
  27. //
  28. // CEditStringListBoxCommand::~CEditStringListBoxCommand
  29. //
  30. //---------------------------------------------------------------
  31. CEditStringListBoxCommand::~CEditStringListBoxCommand()
  32. {
  33. }
  34.  
  35.  
  36. //---------------------------------------------------------------
  37. //
  38. // CEditStringListBoxCommand::CEditStringListBoxCommand
  39. //
  40. //---------------------------------------------------------------
  41. CEditStringListBoxCommand::CEditStringListBoxCommand(TStringListBox* pane, const SStringListBoxInfo& oldInfo, const SStringListBoxInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
  42. {
  43. }
  44.  
  45.  
  46. //---------------------------------------------------------------
  47. //
  48. // CEditStringListBoxCommand::UpdatePane
  49. //
  50. //---------------------------------------------------------------
  51. void CEditStringListBoxCommand::UpdatePane(const SStringListBoxInfo& info)
  52. {
  53.     mPane->SetTypeAhead(info.useTypeAhead);
  54.     mPane->SetTextTraits(info.traitsID);
  55. }
  56.  
  57. #pragma mark -
  58.  
  59. // ===================================================================================
  60. //    CStringListBoxEditor
  61. // ===================================================================================
  62.  
  63. static TReanimatorRegister<CStringListBoxEditor> sStringListBoxEditorRegistrar;
  64.  
  65. //---------------------------------------------------------------
  66. //
  67. // CStringListBoxEditor::~CStringListBoxEditor
  68. //
  69. //---------------------------------------------------------------
  70. CStringListBoxEditor::~CStringListBoxEditor()
  71. {
  72. }
  73.  
  74.  
  75. //---------------------------------------------------------------
  76. //
  77. // CStringListBoxEditor::CStringListBoxEditor
  78. //
  79. //---------------------------------------------------------------
  80. CStringListBoxEditor::CStringListBoxEditor(TView* superView) : Inherited(superView)
  81. {
  82. }
  83.  
  84.  
  85. //---------------------------------------------------------------
  86. //
  87. // CStringListBoxEditor::Create                                [static]
  88. //
  89. //---------------------------------------------------------------
  90. MReanimatable* CStringListBoxEditor::Create(MReanimatable* parent)
  91. {
  92.     return new CStringListBoxEditor(dynamic_cast<TView*>(parent));
  93. }
  94.  
  95.  
  96. //---------------------------------------------------------------
  97. //
  98. // CStringListBoxEditor::GetEditorInfo        
  99. //
  100. //---------------------------------------------------------------
  101. SStringListBoxInfo CStringListBoxEditor::GetEditorInfo() const
  102. {
  103.     SStringListBoxInfo info;
  104.             
  105.     TControl* control = dynamic_cast<TControl*>(this->FindSubPane("Type Ahead"));
  106.     info.useTypeAhead = control->GetValue();
  107.     
  108.     CRsrcPopupMenu* popup = dynamic_cast<CRsrcPopupMenu*>(this->FindSubPane("Traits ID"));
  109.     info.traitsID = popup->GetID();
  110.     
  111.     return info;
  112. }
  113.  
  114.  
  115. //---------------------------------------------------------------
  116. //
  117. // CStringListBoxEditor::SetEditorInfo
  118. //
  119. //---------------------------------------------------------------
  120. void CStringListBoxEditor::SetEditorInfo(const SStringListBoxInfo& info)
  121. {    
  122.     TControl* control = dynamic_cast<TControl*>(this->FindSubPane("Type Ahead"));
  123.     control->SetValue(info.useTypeAhead);
  124.     
  125.     CRsrcPopupMenu* popup = dynamic_cast<CRsrcPopupMenu*>(this->FindSubPane("Traits ID"));
  126.     popup->SetID(info.traitsID);
  127. }
  128.  
  129.  
  130.  
  131.